package com.cookie.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author DELL
 */
@RequestMapping("/dashboard")
@Controller
@ApiIgnore
public class DashBoardController {
    protected HttpServletRequest request;
    protected HttpServletResponse response;

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
    public String welcome() {
        return "manager";
    }

    @RequestMapping(value = "/userDetail", method = {RequestMethod.GET, RequestMethod.POST})
    public String home(Model model) {
        model.addAttribute("mySessionId", request.getSession().getId());
        return "user_detail";
    }

    @ModelAttribute
    public void setReqAndRes(HttpServletRequest request, HttpServletResponse response) {
        this.request = request;
        this.response = response;
    }
}
